From 3d5dce67a4648e1cd85c08f5a89bc3e34601a077 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 15 May 2025 12:30:25 +0200 Subject: [PATCH] fix(delete): fix move to trash when parent folder is read-only Signed-off-by: Matthieu Gallien --- src/libsync/propagatorjobs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index c2b929d83..272fe40b6 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -110,6 +110,9 @@ void PropagateLocalRemove::start() if (_moveToTrash && propagator()->syncOptions()._vfs->mode() != OCC::Vfs::WindowsCfApi) { const auto fileInfo = QFileInfo{filename}; if (FileSystem::fileExists(filename, fileInfo)) { + const auto parentFolderPath = fileInfo.dir().absolutePath(); + const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite}; + if (!FileSystem::moveToTrash(filename, &removeError)) { qCWarning(lcPropagateLocalRemove()) << "move to trash failed" << filename << removeError; done(SyncFileItem::NormalError, tr("Temporary error when removing local item removed from server."), ErrorCategory::GenericError); -- 2.30.2